(function(){ var temp=wpgmaps_mapid.wpgmza_legacy_current_map_id; window.wpgmaps_mapid=temp; })(); var WPGM_Path_Polygon=new Array(); var WPGM_Path=new Array(); var infoWindow_poly=Array(); var marker_array=Array(); var marker_sl=null; for (var entry in wpgmaps_localize){ if('undefined'===typeof window.jQuery){ setTimeout(function(){ document.getElementById('wpgmza_map').innerHTML='Error: In order for WP Google Maps to work, jQuery must be installed. A check was done and jQuery was not present. Please see the jQuery troubleshooting section of our site for more information.'; }, 5000); }} function wpgmza_parse_theme_data(raw){ var json; try{ json=JSON.parse(raw); }catch(e){ try{ json=eval(raw); }catch(e){ console.warn("Couldn't parse theme data"); return []; }} return json; } function wpgmza_get_guid(){ function s4(){ return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); } function wpgmza_open_info_window(infoWindow, content){ var guid=wpgmza_get_guid(); var div=$("
"); wpgmza_init_infowindow(); infoWindow.setContent(div); infoWindow.open(); $("div[data-info-window-guid='" + guid + "']").trigger("infowindowopen.wpgmza"); } function InitMap(){ var $=jQuery; if(WPGMZA.googleAPIStatus&&WPGMZA.googleAPIStatus.code=="USER_CONSENT_NOT_GIVEN"){ $("#wpgmza_map, .wpgmza_map").each(function(index, el){ $(el).append($(WPGMZA.api_consent_html)); $(el).css({height: "auto"}); }); $("button.wpgmza-api-consent").on("click", function(event){ Cookies.set("wpgmza-api-consent-given", true); window.location.reload(); }); return; } var myLatLng={ lat: wpgmaps_localize[wpgmaps_mapid].map_start_lat, lng: wpgmaps_localize[wpgmaps_mapid].map_start_lng }; if(typeof wpgmza_override_zoom!=="undefined") MYMAP.init('#wpgmza_map', myLatLng, parseInt(wpgmza_override_zoom)); else MYMAP.init('#wpgmza_map', myLatLng, parseInt(wpgmaps_localize[wpgmaps_mapid].map_start_zoom)); UniqueCode=Math.round(Math.random()*10000); MYMAP.placeMarkers(wpgmaps_markerurl+'?u='+UniqueCode,wpgmaps_localize[wpgmaps_mapid].id,null,null,null); if((wpgmaps_localize[wpgmaps_mapid].other_settings.store_locator_style=='modern'&&WPGMZA.isModernComponentStyleAllowed()) || WPGMZA.settings.user_interface_style=="modern"){ if(!MYMAP.map) return; MYMAP.modernStoreLocator=WPGMZA.ModernStoreLocator.createInstance(wpgmaps_mapid); wpgmza_create_places_autocomplete(); }} jQuery(function($){ if(/1\.([0-7])\.([0-9])/.test(jQuery.fn.jquery)) console.warn("You are running a version of jQuery which may not be compatible with WP Google Maps."); jQuery(document).on({'DOMNodeInserted': function(){ jQuery('.pac-item, .pac-item span', this).addClass('needsclick'); }}, '.pac-container'); var temp; var selector="#wpgmza_map"; var mapElement=jQuery(selector); var width=wpgmaps_localize[wpgmaps_mapid]['map_width']+wpgmaps_localize[wpgmaps_mapid]['map_width_type']; var height=wpgmaps_localize[wpgmaps_mapid]['map_height']+wpgmaps_localize[wpgmaps_mapid]['map_height_type']; if((temp=mapElement.attr("data-shortcode-width"))!="inherit") width=temp; if((temp=mapElement.attr("data-shortcode-height"))!="inherit") height=temp; mapElement.css({ width: width, height: height }); InitMap(); jQuery('body').on('tabsactivate', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('tabsshow', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('accordionactivate', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.wpb_tabs_nav li', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.ui-tabs-nav li', function(event, ui){ InitMap(); }); jQuery('body').on('click', '.tp-tabs li a', function(event, ui){ InitMap(); }); jQuery('body').on('click', '.nav-tabs li a', function(event, ui){ InitMap(); }); jQuery('body').on('click', '.vc_tta-panel-heading', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.ult_exp_section',function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.x-accordion-heading', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.x-nav-tabs li', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.tab-title', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.tab-link', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.et_pb_tabs_controls li', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.fusion-tab-heading', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.et_pb_tab', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.tri-tabs-nav span', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '.gdl-tabs li', function(){setTimeout(function(){InitMap();}, 500); }); jQuery('body').on('click', '#tabnav li', function(){setTimeout(function(){InitMap();}, 500); }); }); var MYMAP={ map: null, bounds: null } if(wpgmaps_localize_global_settings['wpgmza_settings_map_draggable']===""||'undefined'===typeof wpgmaps_localize_global_settings['wpgmza_settings_map_draggable']){ wpgmza_settings_map_draggable=true; }else{ wpgmza_settings_map_draggable=false; } if(wpgmaps_localize_global_settings['wpgmza_settings_map_clickzoom']===""||'undefined'===typeof wpgmaps_localize_global_settings['wpgmza_settings_map_clickzoom']){ wpgmza_settings_map_clickzoom=false; }else{ wpgmza_settings_map_clickzoom=true; } if(wpgmaps_localize_global_settings['wpgmza_settings_map_scroll']===""||'undefined'===typeof wpgmaps_localize_global_settings['wpgmza_settings_map_scroll']){ wpgmza_settings_map_scroll=true; }else{ wpgmza_settings_map_scroll=false; } if(wpgmaps_localize_global_settings['wpgmza_settings_map_zoom']===""||'undefined'===typeof wpgmaps_localize_global_settings['wpgmza_settings_map_zoom']){ wpgmza_settings_map_zoom=true; }else{ wpgmza_settings_map_zoom=false; } if(wpgmaps_localize_global_settings['wpgmza_settings_map_pan']===""||'undefined'===typeof wpgmaps_localize_global_settings['wpgmza_settings_map_pan']){ wpgmza_settings_map_pan=true; }else{ wpgmza_settings_map_pan=false; } if(wpgmaps_localize_global_settings['wpgmza_settings_map_type']===""||'undefined'===typeof wpgmaps_localize_global_settings['wpgmza_settings_map_type']){ wpgmza_settings_map_type=true; }else{ wpgmza_settings_map_type=false; } if(wpgmaps_localize_global_settings['wpgmza_settings_map_streetview']===""||'undefined'===typeof wpgmaps_localize_global_settings['wpgmza_settings_map_streetview']){ wpgmza_settings_map_streetview=true; }else{ wpgmza_settings_map_streetview=false; } if(wpgmaps_localize_global_settings['wpgmza_settings_map_full_screen_control']===""||'undefined'===typeof wpgmaps_localize_global_settings['wpgmza_settings_map_full_screen_control']){ wpgmza_settings_map_full_screen_control=true; }else{ wpgmza_settings_map_full_screen_control=false; } if('undefined'===typeof wpgmaps_localize[wpgmaps_mapid]['other_settings']['map_max_zoom']||wpgmaps_localize[wpgmaps_mapid]['other_settings']['map_max_zoom']===""){ wpgmza_max_zoom=0; }else{ wpgmza_max_zoom=parseInt(wpgmaps_localize[wpgmaps_mapid]['other_settings']['map_max_zoom']); } if('undefined'===typeof wpgmaps_localize[wpgmaps_mapid]['other_settings']['map_min_zoom']||wpgmaps_localize[wpgmaps_mapid]['other_settings']['map_min_zoom']===""){ wpgmza_min_zoom=21; }else{ wpgmza_min_zoom=parseInt(wpgmaps_localize[wpgmaps_mapid]['other_settings']['map_min_zoom']); } function wpgmza_create_places_autocomplete(){ var element=document.getElementById("addressInput"); if(!element) return; if(!window.google) return; if(!google.maps) return; if(!google.maps.places||!google.maps.places.Autocomplete) return; if(WPGMZA.settings.engine=="open-layers") return; var options={ fields: ["name", "formatted_address"], types: ["geocode"] }; var restriction=wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_store_locator_restrict']; if(restriction) options.componentRestrictions={ country: restriction }; autocomplete=new google.maps.places.Autocomplete(element, options); google.maps.event.addListener(autocomplete, 'place_changed', function(){ fillInAddress(); }); } MYMAP.init=function(selector, latLng, zoom){ var maptype=null; if(window.google&&google.maps){ if(typeof wpgmaps_localize[wpgmaps_mapid].type!=="undefined"){ if(wpgmaps_localize[wpgmaps_mapid].type==="1"){ maptype=google.maps.MapTypeId.ROADMAP; } else if(wpgmaps_localize[wpgmaps_mapid].type==="2"){ maptype=google.maps.MapTypeId.SATELLITE; } else if(wpgmaps_localize[wpgmaps_mapid].type==="3"){ maptype=google.maps.MapTypeId.HYBRID; } else if(wpgmaps_localize[wpgmaps_mapid].type==="4"){ maptype=google.maps.MapTypeId.TERRAIN; }else{ maptype=google.maps.MapTypeId.ROADMAP; }}else{ maptype=google.maps.MapTypeId.ROADMAP; }} var myOptions={ zoom:zoom, minZoom: wpgmza_max_zoom, maxZoom: wpgmza_min_zoom, center: latLng, zoomControl: wpgmza_settings_map_zoom, panControl: wpgmza_settings_map_pan, mapTypeControl: wpgmza_settings_map_type, streetViewControl: wpgmza_settings_map_streetview, draggable: wpgmza_settings_map_draggable, disableDoubleClickZoom: wpgmza_settings_map_clickzoom, scrollwheel: wpgmza_settings_map_scroll, fullscreenControl: wpgmza_settings_map_full_screen_control, mapTypeId: maptype } if(typeof wpgmza_force_greedy_gestures!=="undefined"){ myOptions.gestureHandling=wpgmza_force_greedy_gestures; } if("undefined"!==typeof wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_theme_data']&&wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_theme_data']!==false&&wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_theme_data']!==""){ if(!myOptions.styles) myOptions.styles=[]; wpgmza_theme_data=wpgmza_parse_theme_data(wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_theme_data']); myOptions.styles=myOptions.styles.concat(wpgmza_theme_data); } if(typeof wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_auto_night']!='undefined'&&wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_auto_night']==1){ var date=new Date(); var isNightTime=date.getHours() < 7||date.getHours() > 19; if(isNightTime){ myOptions.styles=myOptions.styles.concat(WPGMZA.Map.nightTimeThemeData); }} if(!wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_show_points_of_interest']){ if(!myOptions.styles) myOptions.styles=[]; myOptions.styles.push({ featureType: "poi", stylers: [{visibility: "off"}] } ); } var element=jQuery(selector)[0]; if(!element) return; element.setAttribute("data-map-id", 1); element.setAttribute("data-maps-engine", WPGMZA.settings.engine); this.map=WPGMZA.Map.createInstance(element, myOptions); this.bounds=new WPGMZA.LatLngBounds(); if(MYMAP.modernStoreLocator&&MYMAP.modernStoreLocator.element){ MYMAP.modernStoreLocator.element.index=1; this.map.controls[google.maps.ControlPosition.TOP_CENTER].push(MYMAP.modernStoreLocator.element); wpgmza_create_places_autocomplete(); } /*var map=this.map; google.maps.event.addDomListener(window, "resize", function(){ var center=map.getCenter(); google.maps.event.trigger(map, "resize"); map.setCenter(center); });*/ jQuery("#wpgmza_map").trigger('wpgooglemaps_loaded'); if(wpgmaps_localize_polygon_settings!==null){ if(typeof wpgmaps_localize_polygon_settings!=="undefined"){ for(var poly_entry in wpgmaps_localize_polygon_settings){ add_polygon(poly_entry); }} } if(wpgmaps_localize_polyline_settings!==null){ if(typeof wpgmaps_localize_polyline_settings!=="undefined"){ for(var poly_entry in wpgmaps_localize_polyline_settings){ add_polyline(poly_entry); }} } if(WPGMZA.settings.engine=="google-maps"){ if(wpgmaps_localize[wpgmaps_mapid]['bicycle']==="1"){ var bikeLayer=new google.maps.BicyclingLayer(); bikeLayer.setMap(MYMAP.map.googleMap); } if(wpgmaps_localize[wpgmaps_mapid]['traffic']==="1"){ var trafficLayer=new google.maps.TrafficLayer(); trafficLayer.setMap(MYMAP.map.googleMap); } if("undefined"!==typeof wpgmaps_localize[wpgmaps_mapid]['other_settings']['transport_layer']&&wpgmaps_localize[wpgmaps_mapid]['other_settings']['transport_layer']===1){ var transitLayer=new google.maps.TransitLayer(); transitLayer.setMap(MYMAP.map.googleMap); }} if(window.wpgmza_circle_data_array){ window.circle_array=[]; for(var circle_id in wpgmza_circle_data_array){ if(!wpgmza_circle_data_array.hasOwnProperty(circle_id)) continue; add_circle(1, wpgmza_circle_data_array[circle_id]); }} if(window.wpgmza_rectangle_data_array){ window.rectangle_array=[]; for(var rectangle_id in wpgmza_rectangle_data_array){ if(!wpgmza_rectangle_data_array.hasOwnProperty(rectangle_id)) continue; add_rectangle(1, wpgmza_rectangle_data_array[rectangle_id]); }} MYMAP.map.on("click", function(event){ if(event.target instanceof WPGMZA.Marker) return; if(window.infoWindow) infoWindow.close(); }); window.addEventListener("keydown", function(e){ var k=(e.which ? e.which:e.keyCode); if(k==27) infoWindow.close(); }); } function wpgmza_init_infowindow(){ if(!window.WPGMZA) return; window.infoWindow=WPGMZA.InfoWindow.createInstance(); if(wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']&&wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width'].length) infoWindow.setOptions({maxWidth: wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']}); } function wpgmza_get_zoom_from_radius(radius, units){ if(units==WPGMZA.Distance.MILES) radius *=WPGMZA.Distance.KILOMETERS_PER_MILE; return Math.round(14-Math.log(radius)/Math.LN2); } var wpgmza_last_default_circle=null; function wpgmza_show_store_locator_radius(map_id, center, radius, distance_type){ return; } MYMAP.placeMarkers=function(filename,map_id,radius,searched_center,distance_type){ var check1=0, slNotFoundMessage=jQuery('.js-not-found-msg'); if(wpgmaps_localize_global_settings.wpgmza_settings_marker_pull==='1'){ jQuery.get(filename, function(xml){ jQuery(xml).find("marker").each(function(){ var wpmgza_map_id=jQuery(this).find('map_id').text(); if(wpmgza_map_id==map_id){ var wpmgza_address=jQuery(this).find('address').text(); var lat=jQuery(this).find('lat').text(); var lng=jQuery(this).find('lng').text(); var wpmgza_anim=jQuery(this).find('anim').text(); var wpmgza_infoopen=jQuery(this).find('infoopen').text(); var current_lat=jQuery(this).find('lat').text(); var current_lng=jQuery(this).find('lng').text(); var show_marker_radius=true; var wpmgza_marker_id=jQuery(this).find('marker_id').text(); if(radius!==null){ var R=0; if(distance_type=="1"){ R=3958.7558657440545; }else{ R=6378.16; } var dLat=toRad(searched_center.lat-current_lat); var dLon=toRad(searched_center.lng-current_lng); var a=Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(toRad(current_lat)) * Math.cos(toRad(searched_center.lat)) * Math.sin(dLon/2) * Math.sin(dLon/2); var c=2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var d=R * c; if(d < radius){ show_marker_radius=true; }else{ show_marker_radius=false; }} var point=new WPGMZA.LatLng(parseFloat(lat),parseFloat(lng)); if(show_marker_radius===true){ var options={ position: point, map: MYMAP.map } if(wpmgza_anim) options.animation=wpmgza_anim; var marker=WPGMZA.Marker.createInstance(options); var d_string=""; if(radius!==null){ if(distance_type=="1"){ d_string=""+Math.round(d,2)+" "+wpgmaps_lang_m_away+"
"; }else{ d_string=""+Math.round(d,2)+" "+wpgmaps_lang_km_away+"
"; }}else{ d_string=''; } var html=''+wpmgza_address+''+d_string; if(wpmgza_infoopen==="1"&&!wpgmaps_localize_global_settings["wpgmza_settings_disable_infowindows"]){ if(!window.infoWindow) wpgmza_init_infowindow(); infoWindow.setContent(html); infoWindow.open(MYMAP.map, marker); } temp_actiontype='click'; if(typeof wpgmaps_localize_global_settings.wpgmza_settings_map_open_marker_by!=="undefined"&&wpgmaps_localize_global_settings.wpgmza_settings_map_open_marker_by=='2'){ temp_actiontype='mouseover'; } if(WPGMZA.isTouchDevice()) temp_actiontype="click"; var html=''+wpmgza_address+''; marker.on(temp_actiontype, function(){ this.openInfoWindow(); this.infoWindow.setContent(html); }); marker_array[wpmgza_marker_id]=marker; }} }); }); }else{ if(Object.keys(wpgmaps_localize_marker_data).length > 0){ var markerStoreLocatorsNum=0; if(typeof wpgmaps_localize_marker_data!=="undefined"){ jQuery.each(wpgmaps_localize_marker_data, function(i, val){ var wpmgza_map_id=val.map_id; if(wpmgza_map_id==map_id){ var wpmgza_address=val.address; var wpmgza_anim=val.anim; var wpmgza_infoopen=val.infoopen; var lat=val.lat; var lng=val.lng; var point=new WPGMZA.LatLng(lat, lng); var wpmgza_marker_id=val.marker_id; var current_lat=val.lat; var current_lng=val.lng; var show_marker_radius=true; if(radius!==null){ if(check1 > 0){ }else{ var point=searched_center; check1=check1 + 1; } var R=0; if(distance_type=="1"){ R=3958.7558657440545; }else{ R=6378.16; } var dLat=toRad(searched_center.lat-current_lat); var dLon=toRad(searched_center.lng-current_lng); var a=Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(toRad(current_lat)) * Math.cos(toRad(searched_center.lat)) * Math.sin(dLon/2) * Math.sin(dLon/2); var c=2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var d=R * c; if(d < radius){ show_marker_radius=true; markerStoreLocatorsNum++; }else{ show_marker_radius=false; }} var point={ lat: parseFloat(lat), lng: parseFloat(lng) }; if(WPGMZA.is_admin=="1") return; if(show_marker_radius===true){ var marker=WPGMZA.Marker.createInstance({ position: point, map: MYMAP.map }); if(wpmgza_anim) marker.setAnimation(wpmgza_anim); var d_string=""; if(radius!==null){ if(distance_type=="1"){ d_string=""+Math.round(d,2)+" "+wpgmaps_lang_m_away+"
"; }else{ d_string=""+Math.round(d,2)+" "+wpgmaps_lang_km_away+"
"; }}else{ d_string=''; } var html=''+wpmgza_address+''+d_string; if(wpmgza_infoopen==="1"&&!wpgmaps_localize_global_settings["wpgmza_settings_disable_infowindows"]){ wpgmza_init_infowindow(); infoWindow.setContent(html); infoWindow.open(MYMAP.map, marker); } temp_actiontype='click'; if(typeof wpgmaps_localize_global_settings.wpgmza_settings_map_open_marker_by!=="undefined"&&wpgmaps_localize_global_settings.wpgmza_settings_map_open_marker_by=='2'){ temp_actiontype='mouseover'; } if(WPGMZA.isTouchDevice()) temp_actiontype="click"; marker.on(temp_actiontype, function(event){ this.openInfoWindow(); this.infoWindow.setContent(html); }); marker_array[wpmgza_marker_id]=marker; }} }); if(''!==jQuery('#addressInput').val()&&markerStoreLocatorsNum < 1){ slNotFoundMessage.addClass('is-active'); setTimeout(function (){ slNotFoundMessage.removeClass('is-active'); }, 5000); }} }} if(check1==0&&radius){ var point=new WPGMZA.LatLng(parseFloat(searched_center.lat),parseFloat(searched_center.lng)); if(typeof wpgmaps_localize[wpgmaps_mapid]['other_settings']['store_locator_bounce']==="undefined"||wpgmaps_localize[wpgmaps_mapid]['other_settings']['store_locator_bounce']===1){ var marker=WPGMZA.Marker.createInstance({ position: point, map: MYMAP.map, animation: WPGMZA.Marker.ANIMATION_BOUNCE }) marker_sl=marker; } wpgmza_show_store_locator_radius(map_id, point, radius, distance_type); check1=check1 + 1; }} function add_polygon(polygonid){ if(WPGMZA.settings.engine=="open-layers") return; var tmp_data=wpgmaps_localize_polygon_settings[polygonid]; var current_poly_id=polygonid; var tmp_polydata=tmp_data['polydata']; var WPGM_PathData=new Array(); for (tmp_entry2 in tmp_polydata){ if(typeof tmp_polydata[tmp_entry2][0]!=="undefined"){ WPGM_PathData.push(new google.maps.LatLng(tmp_polydata[tmp_entry2][0], tmp_polydata[tmp_entry2][1])); }} if(tmp_data['lineopacity']===null||tmp_data['lineopacity']===""){ tmp_data['lineopacity']=1; } var bounds=new google.maps.LatLngBounds(); for (i=0; i < WPGM_PathData.length; i++){ bounds.extend(WPGM_PathData[i]); } WPGM_Path_Polygon[polygonid]=new google.maps.Polygon({ path: WPGM_PathData, clickable: true, strokeColor: "#"+tmp_data['linecolor'], fillOpacity: tmp_data['opacity'], strokeOpacity: tmp_data['lineopacity'], fillColor: "#"+tmp_data['fillcolor'], strokeWeight: 2, map: MYMAP.map.googleMap }); WPGM_Path_Polygon[polygonid].setMap(MYMAP.map.googleMap); polygon_center=bounds.getCenter(); if(tmp_data['title']!==""){ infoWindow_poly[polygonid]=new google.maps.InfoWindow(); google.maps.event.addListener(WPGM_Path_Polygon[polygonid], 'click', function(event){ infoWindow_poly[polygonid].setPosition(event.latLng); content=""; if(tmp_data['link']!==""){ var content=""+tmp_data['title']+""; }else{ var content=tmp_data['title']; } if(!wpgmaps_localize_global_settings["wpgmza_settings_disable_infowindows"]){ infoWindow_poly[polygonid].setContent(content); infoWindow_poly[polygonid].open(MYMAP.map,this.position); }}); }} function add_polyline(polyline){ if(WPGMZA.settings.engine=="open-layers") return; var tmp_data=wpgmaps_localize_polyline_settings[polyline]; var current_poly_id=polyline; var tmp_polydata=tmp_data['polydata']; var WPGM_Polyline_PathData=new Array(); for (tmp_entry2 in tmp_polydata){ if(typeof tmp_polydata[tmp_entry2][0]!=="undefined"&&typeof tmp_polydata[tmp_entry2][1]!=="undefined"){ var lat=tmp_polydata[tmp_entry2][0].replace(')', ''); lat=lat.replace('(',''); var lng=tmp_polydata[tmp_entry2][1].replace(')', ''); lng=lng.replace('(',''); WPGM_Polyline_PathData.push(new google.maps.LatLng(lat, lng)); }} if(tmp_data['lineopacity']===null||tmp_data['lineopacity']===""){ tmp_data['lineopacity']=1; } WPGM_Path[polyline]=new google.maps.Polyline({ path: WPGM_Polyline_PathData, strokeColor: "#"+tmp_data['linecolor'], strokeOpacity: tmp_data['opacity'], strokeWeight: tmp_data['linethickness'], map: MYMAP.map.googleMap }); WPGM_Path[polyline].setMap(MYMAP.map.googleMap); } jQuery("body").on("keypress","#addressInput", function(event){ if(event.which==13){ jQuery('.wpgmza_sl_search_button').trigger('click'); }}); var autocomplete; function fillInAddress(){ } jQuery(window).on("load", function(){ wpgmza_create_places_autocomplete(); }); function searchLocations(map_id){ var address=document.getElementById("addressInput").value; if(address.length==0){ document.getElementById("addressInput").focus(); return; } var geocoder=WPGMZA.Geocoder.createInstance(); var options={ address: address }; var restrict=wpgmaps_localize[wpgmaps_mapid]['other_settings']['wpgmza_store_locator_restrict']; if(restrict&&restrict.length) options.componentRestrictions={ country: restrict }; geocoder.geocode(options, function(results, status){ var event={ type: "storelocatorgeocodecomplete", results: results, status: status }; MYMAP.map.trigger(event); if(status==WPGMZA.Geocoder.SUCCESS){ searchLocationsNear(map_id,results[0].geometry.location); }else{ alert(address + ' not found'); }}); } function clearLocations(){ if(window.infoWindow) infoWindow.close(); } function searchLocationsNear(mapid,center_searched){ clearLocations(); var distance_type=wpgmaps_localize[mapid].other_settings.store_locator_distance; var radius=document.getElementById('radiusSelect').value; var zoomie=wpgmza_get_zoom_from_radius(radius); MYMAP.map.setCenter(center_searched); MYMAP.map.setZoom(zoomie); if(typeof marker_array!=="undefined"){ jQuery.each(marker_array,function(i,v){ if(typeof v!=='undefined'){ v.setMap(null); }}); } if(marker_sl!==null){ marker_sl.setMap(null); } MYMAP.placeMarkers(wpgmaps_markerurl+'?u='+UniqueCode,wpgmaps_localize[wpgmaps_mapid].id,radius,center_searched,distance_type); var event={ type: "storelocatorresult", position: center_searched }; MYMAP.map.trigger(event); var event={ type: "filteringcomplete", filteringParams: { center: center_searched, radius: radius }}; MYMAP.map.markerFilter.trigger(event); } function toRad(Value){ return Value * Math.PI / 180; } (function($){ if(!window.WPGMZA) return; WPGMZA.hexToRgba=function(hex){ var c; if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){ c=hex.substring(1).split(''); if(c.length==3){ c=[c[0], c[0], c[1], c[1], c[2], c[2]]; } c='0x'+c.join(''); return { r: (c>>16)&255, g: (c>>8)&255, b: c&255, a: 1 };} throw new Error('Bad Hex'); } WPGMZA.rgbaToString=function(rgba){ return "rgba(" + rgba.r + ", " + rgba.g + ", " + rgba.b + ", " + rgba.a + ")"; }})(jQuery); function add_circle(mapid, data){ if(WPGMZA.settings.engine=="open-layers") return; data.map=MYMAP.map.googleMap; if(!(data.center instanceof google.maps.LatLng)){ if(typeof data.center!="string") return; var m=data.center.match(/-?\d+(\.\d*)?/g); data.center=new google.maps.LatLng({ lat: parseFloat(m[0]), lng: parseFloat(m[1]), }); } data.radius=parseFloat(data.radius); data.fillColor=data.color; data.fillOpacity=parseFloat(data.opacity); data.strokeOpacity=0; var circle=new google.maps.Circle(data); circle_array.push(circle); } function add_rectangle(mapid, data){ if(WPGMZA.settings.engine=="open-layers") return; data.map=MYMAP.map.googleMap; data.fillColor=data.color; data.fillOpacity=parseFloat(data.opacity); var northWest=data.cornerA; var southEast=data.cornerB; var m=northWest.match(/-?\d+(\.\d+)?/g); var north=parseFloat(m[0]); var west=parseFloat(m[1]); m=southEast.match(/-?\d+(\.\d+)?/g); var south=parseFloat(m[0]); var east=parseFloat(m[1]); data.bounds={ north: north, west: west, south: south, east: east }; data.strokeOpacity=0; var rectangle=new google.maps.Rectangle(data); rectangle_array.push(rectangle); }; !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ol=e():t.ol=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(t,e,r){t.exports=function(){"use strict";function t(t,n,i,o,a){!function t(r,n,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,u=n-i+1,l=Math.log(s),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(s-h)/s)*(u-s/2<0?-1:1),p=Math.max(i,Math.floor(n-u*h/s+c)),f=Math.min(o,Math.floor(n+(s-u)*h/s+c));t(r,n,p,f,a)}var d=r[n],_=i,g=o;for(e(r,i,n),a(r[o],d)>0&&e(r,i,o);_=e;f--){var d=t.children[f];s(u,t.leaf?i(d):d),l+=c(u)}return l},n.prototype._adjustParentBBoxes=function(t,e,r){for(var n=r;n>=0;n--)s(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,r=void 0;e>=0;e--)0===t[e].children.length?e>0?(r=t[e-1].children).splice(r.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},n}()},function(t,e){var r=null,n=null;function i(t,e,r){t.addEventListener(e,function(t){var i=new MouseEvent(r,t);i.pointerId=1,i.isPrimary=!0,i.pointerType="mouse",i.width=1,i.height=1,i.tiltX=0,i.tiltY=0,"buttons"in t&&0!==t.buttons?i.pressure=.5:i.pressure=0;var o=t.target;null!==n&&(o=n,"mouseup"===e&&(n=null)),o.dispatchEvent(i),i.defaultPrevented&&t.preventDefault()})}function o(t,e,n){t.addEventListener(e,function(t){for(var i=t.changedTouches,o=i.length,a=0;a j&&(this.fill_(t),b=0),L>j&&(t.stroke(),L=0),b||L||(t.beginPath(),p=NaN,f=NaN),++C;break;case Zc.CIRCLE:var U=a[I=k[1]],Y=a[I+1],B=a[I+2]-U,z=a[I+3]-Y,X=Math.sqrt(B*B+z*z);t.moveTo(U+X,Y),t.arc(U,Y,X,0,2*Math.PI,!0),++C;break;case Zc.CLOSE_PATH:t.closePath(),++C;break;case Zc.CUSTOM:I=k[1],l=k[2];var V=k[3],W=k[4],Z=6==k.length?k[5]:void 0;D.geometry=V,D.feature=x,C in A||(A[C]=[]);var K=A[C];Z?Z(a,I,l,2,K):(K[0]=a[I],K[1]=a[I+1],K.length=2),W(K,D),++C;break;case Zc.DRAW_IMAGE:I=k[1],l=k[2],v=k[3],h=k[4],c=k[5],y=i?null:k[6];var H=k[7],q=k[8],J=k[9],Q=k[10],$=k[11],tt=k[12],et=k[13],rt=k[14];if(!v&&k.length>=19){m=k[18],E=k[19],T=k[20],S=k[21];var nt=this.drawLabelWithPointPlacement_(m,E,T,S);v=nt.label,k[3]=v;var it=k[22];h=(nt.anchorX-it)*this.pixelRatio,k[4]=h;var ot=k[23];c=(nt.anchorY-ot)*this.pixelRatio,k[5]=c,H=v.height,k[7]=H,rt=v.width,k[14]=rt}var at=void 0;k.length>24&&(at=k[24]);var st=void 0,ut=void 0,lt=void 0;k.length>16?(st=k[15],ut=k[16],lt=k[17]):(st=pa,ut=!1,lt=!1),$&&G?tt+=N:$||G||(tt-=N);for(var ht=0,ct=0;I >1):i>>1}return e}(t),i=0,o=n.length;i>1,h=-7,c=r?i-1:0,p=r?-1:1,f=t[e+c];for(c+=p,o=f&(1<<-h)-1,f>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=p,h-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l}return(f?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,l=8*o-i-1,h=(1<T&&Pr(t,e,r,n,l=(h+c)/2,d)&&(m=l,T=S),h=c}return isNaN(m)&&(m=i[o]),a?(a.push(m,d,T),a):[m,d,T]}function br(t,e,r,n,i){for(var o=[],a=0,s=r.length;a=i[0]&&o[2]<=i[2]||(o[1]>=i[1]&&o[3]<=i[3]||Lr(t,e,r,n,function(t,e){return function(t,e,r){var n=!1,i=at(t,e),o=at(t,r);if(i===Q.INTERSECTING||o===Q.INTERSECTING)n=!0;else{var a=t[0],s=t[1],u=t[2],l=t[3],h=e[0],c=e[1],p=r[0],f=r[1],d=(f-c)/(p-h),_=void 0,g=void 0;o&Q.ABOVE&&!(i&Q.ABOVE)&&(n=(_=p-(f-l)/d)>=a&&_<=u),n||!(o&Q.RIGHT)||i&Q.RIGHT||(n=(g=f-(p-u)*d)>=s&&g<=l),n||!(o&Q.BELOW)||i&Q.BELOW||(n=(_=p-(f-s)/d)>=a&&_<=u),n||!(o&Q.LEFT)||i&Q.LEFT||(n=(g=f-(p-a)*d)>=s&&g<=l)}return n}(i,t,e)}))))}function Fr(t,e,r,n,i){if(!function(t,e,r,n,i){return!!Mr(t,e,r,n,i)||(!!Cr(t,e,r,n,i[0],i[1])||(!!Cr(t,e,r,n,i[0],i[3])||(!!Cr(t,e,r,n,i[2],i[1])||!!Cr(t,e,r,n,i[2],i[3]))))}(t,e,r[0],n,i))return!1;if(1===r.length)return!0;for(var o=1,a=r.length;o0}function Gr(t,e,r,n,i){for(var o=void 0!==i&&i,a=0,s=r.length;a0&&this.points_[r+2]>t;)r-=3;var n=this.points_[e+2]-this.points_[r+2];if(n<1e3/60)return!1;var i=this.points_[e]-this.points_[r],o=this.points_[e+1]-this.points_[r+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),Jr=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qr=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.map=r,i.frameState=void 0!==n?n:null,i}return Jr(e,t),e}(M),$r=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tn=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,o)||this;return a.originalEvent=n,a.pixel_=null,a.coordinate_=null,a.dragging=void 0!==i&&i,a}return $r(e,t),Object.defineProperty(e.prototype,"pixel",{get:function(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_},set:function(t){this.pixel_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"coordinate",{get:function(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_},set:function(t){this.coordinate_=t},enumerable:!0,configurable:!0}),e.prototype.preventDefault=function(){t.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},e.prototype.stopPropagation=function(){t.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()},e}(Qr),en=(r(1),"undefined"!=typeof navigator?navigator.userAgent.toLowerCase():""),rn=-1!==en.indexOf("firefox"),nn=(-1!==en.indexOf("safari")&&en.indexOf("chrom"),-1!==en.indexOf("webkit")&&-1==en.indexOf("edge")),on=-1!==en.indexOf("macintosh"),an=window.devicePixelRatio||1,sn="undefined"!=typeof Image&&Image.prototype.decode,un=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}(),ln={SINGLECLICK:"singleclick",CLICK:N.CLICK,DBLCLICK:N.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},hn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cn=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,n,i,o)||this;return a.pointerEvent=n,a}return hn(e,t),e}(tn),pn={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},fn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dn=function(t){function e(e,r){var n=t.call(this,e)||this;n.map_=e,n.clickTimeoutId_,n.dragging_=!1,n.dragListenerKeys_=[],n.moveTolerance_=r?r*an:an,n.down_=null;var i=n.map_.getViewport();return n.activePointers_=0,n.trackedTouches_={},n.element_=i,n.pointerdownListenerKey_=g(i,pn.POINTERDOWN,n.handlePointerDown_,n),n.originalPointerMoveEvent_,n.relayedListenerKey_=g(i,pn.POINTERMOVE,n.relayEvent_,n),n.boundHandleTouchMove_=n.handleTouchMove_.bind(n),n.element_.addEventListener(N.TOUCHMOVE,n.boundHandleTouchMove_,!!un&&{passive:!1}),n}return fn(e,t),e.prototype.emulateClick_=function(t){var e=new cn(ln.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new cn(ln.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=void 0;var e=new cn(ln.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}.bind(this),250)},e.prototype.updateActivePointers_=function(t){var e=t;e.type==ln.POINTERUP||e.type==ln.POINTERCANCEL?delete this.trackedTouches_[e.pointerId]:e.type==ln.POINTERDOWN&&(this.trackedTouches_[e.pointerId]=!0),this.activePointers_=Object.keys(this.trackedTouches_).length},e.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var e=new cn(ln.POINTERUP,this.map_,t);this.dispatchEvent(e),e.propagationStopped||this.dragging_||!this.isMouseActionButton_(t)||this.emulateClick_(this.down_),0===this.activePointers_&&(this.dragListenerKeys_.forEach(v),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)},e.prototype.isMouseActionButton_=function(t){return 0===t.button},e.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var e=new cn(ln.POINTERDOWN,this.map_,t);this.dispatchEvent(e),this.down_=t,0===this.dragListenerKeys_.length&&this.dragListenerKeys_.push(g(document,ln.POINTERMOVE,this.handlePointerMove_,this),g(document,ln.POINTERUP,this.handlePointerUp_,this),g(this.element_,ln.POINTERCANCEL,this.handlePointerUp_,this))},e.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=!0;var e=new cn(ln.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(e)}},e.prototype.relayEvent_=function(t){this.originalPointerMoveEvent_=t;var e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new cn(t.type,this.map_,t,e))},e.prototype.handleTouchMove_=function(t){this.originalPointerMoveEvent_.defaultPrevented&&t.preventDefault()},e.prototype.isMoving_=function(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(v(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(N.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(v(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(v),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(A),_n="postrender",gn="movestart",yn="moveend",vn={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},mn="prerender",En="postrender",Tn="precompose",Sn="postcompose",xn="rendercomplete",wn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},Rn=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,f(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,r=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(r);return delete this.queuedElements_[n],r},t.prototype.enqueue=function(t){K(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,r=this.priorities_,n=e.length,i=e[t],o=r[t],a=t;t0;)n=(r=this.dequeue()[0]).getKey(),r.getState()!==wn.IDLE||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++i,r.load())},e}(Rn),Pn=42,In=256;function bn(t,e,r){return function(n,i,o,a){if(n){var s=e?0:o[0]*i,u=e?0:o[1]*i,l=t[0]+s/2,h=t[2]-s/2,c=t[1]+u/2,p=t[3]-u/2;l>h&&(h=l=(h+l)/2),c>p&&(p=c=(p+c)/2);var f=kt(n[0],l,h),d=kt(n[1],c,p),_=30*i;return a&&r&&(f+=-_*Math.log(1+Math.max(0,l-n[0])/_)+_*Math.log(1+Math.max(0,n[0]-h)/_),d+=-_*Math.log(1+Math.max(0,c-n[1])/_)+_*Math.log(1+Math.max(0,n[1]-p)/_)),[f,d]}}}function Ln(t){return t}function Mn(t,e,r,n){var i=It(e)/r[0],o=Rt(e)/r[1];return n?Math.min(t,Math.max(i,o)):Math.min(t,Math.min(i,o))}function Fn(t,e,r){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,r&&(n=Math.max(n,r),n/=Math.log(1+50*Math.max(0,r/t-1))/50+1),kt(n,r/2,2*e)}function An(t,e,r,n,i){return function(o,a,s,u){if(void 0!==o){var l=n?Mn(t,n,s,i):t;return(void 0===r||r)&&u?Fn(o,l,e):kt(o,e,l)}}}function Nn(t){return void 0!==t?0:void 0}function Gn(t){return void 0!==t?t:void 0}var Dn=0,jn=1,kn="center",Un="resolution",Yn="rotation";function Bn(t,e,r){var n=void 0!==r?t.toFixed(r):""+t,i=n.indexOf(".");return(i=-1===i?n.length:i)>e?n:new Array(1+e-i).join("0")+n}function zn(t,e){for(var r=(""+t).split("."),n=(""+e).split("."),i=0;id[2])p=[g+_*Math.ceil((d[0]-g)/_),t[1]];n&&f.push([-_,0],[_,0])}var y,v=e.layerStatesArray,m=v.length;this.declutterTree_&&(y=this.declutterTree_.all().map(function(t){return t.value}));for(var E=[],T=0;T0,6);var p=void 0!==n.src?Pa.IDLE:Pa.LOADED;return r.color_=void 0!==n.color?na(n.color):null,r.iconImage_=function(t,e,r,n,i,o){var a=ua.get(e,n,o);return a||(a=new Su(t,e,r,n,i,o),ua.set(e,n,o,a)),a}(l,c,h,r.crossOrigin_,p,r.color_),r.offset_=void 0!==n.offset?n.offset:[0,0],r.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:xu.TOP_LEFT,r.origin_=null,r.size_=void 0!==n.size?n.size:null,r}return wu(e,t),e.prototype.clone=function(){return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==_u.FRACTION||this.anchorYUnits_==_u.FRACTION){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==_u.FRACTION&&(t[0]*=e[0]),this.anchorYUnits_==_u.FRACTION&&(t[1]*=e[1])}if(this.anchorOrigin_!=xu.TOP_LEFT){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=xu.TOP_RIGHT&&this.anchorOrigin_!=xu.BOTTOM_RIGHT||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=xu.BOTTOM_LEFT&&this.anchorOrigin_!=xu.BOTTOM_RIGHT||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_,e=this.getDisplacement();if(this.offsetOrigin_!=xu.TOP_LEFT){var r=this.getSize(),n=this.iconImage_.getSize();if(!r||!n)return null;t=t.slice(),this.offsetOrigin_!=xu.TOP_RIGHT&&this.offsetOrigin_!=xu.BOTTOM_RIGHT||(t[0]=n[0]-r[0]-t[0]),this.offsetOrigin_!=xu.BOTTOM_LEFT&&this.offsetOrigin_!=xu.BOTTOM_RIGHT||(t[1]=n[1]-r[1]-t[1])}return t[0]+=e[0],t[1]+=e[1],this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(N.CHANGE,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(N.CHANGE,t)},e}(lu),Ou=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},t.prototype.getColor=function(){return this.color_},t.prototype.getLineCap=function(){return this.lineCap_},t.prototype.getLineDash=function(){return this.lineDash_},t.prototype.getLineDashOffset=function(){return this.lineDashOffset_},t.prototype.getLineJoin=function(){return this.lineJoin_},t.prototype.getMiterLimit=function(){return this.miterLimit_},t.prototype.getWidth=function(){return this.width_},t.prototype.setColor=function(t){this.color_=t},t.prototype.setLineCap=function(t){this.lineCap_=t},t.prototype.setLineDash=function(t){this.lineDash_=t},t.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t},t.prototype.setLineJoin=function(t){this.lineJoin_=t},t.prototype.setMiterLimit=function(t){this.miterLimit_=t},t.prototype.setWidth=function(t){this.width_=t},t}(),Cu=function(){function t(t){var e=t||{};this.geometry_=null,this.geometryFunction_=Lu,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}return t.prototype.clone=function(){var e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},t.prototype.getRenderer=function(){return this.renderer_},t.prototype.setRenderer=function(t){this.renderer_=t},t.prototype.getGeometry=function(){return this.geometry_},t.prototype.getGeometryFunction=function(){return this.geometryFunction_},t.prototype.getFill=function(){return this.fill_},t.prototype.setFill=function(t){this.fill_=t},t.prototype.getImage=function(){return this.image_},t.prototype.setImage=function(t){this.image_=t},t.prototype.getStroke=function(){return this.stroke_},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.getText=function(){return this.text_},t.prototype.setText=function(t){this.text_=t},t.prototype.getZIndex=function(){return this.zIndex_},t.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Lu,this.geometry_=t},t.prototype.setZIndex=function(t){this.zIndex_=t},t}();var Pu=null;function Iu(t,e){if(!Pu){var r=new du({color:"rgba(255,255,255,0.4)"}),n=new Ou({color:"#3399CC",width:1.25});Pu=[new Cu({image:new fu({fill:r,stroke:n,radius:5}),fill:r,stroke:n})]}return Pu}function bu(){var t={},e=[255,255,255,1],r=[0,153,255,1];return t[Nt.POLYGON]=[new Cu({fill:new du({color:[255,255,255,.5]})})],t[Nt.MULTI_POLYGON]=t[Nt.POLYGON],t[Nt.LINE_STRING]=[new Cu({stroke:new Ou({color:e,width:5})}),new Cu({stroke:new Ou({color:r,width:3})})],t[Nt.MULTI_LINE_STRING]=t[Nt.LINE_STRING],t[Nt.CIRCLE]=t[Nt.POLYGON].concat(t[Nt.LINE_STRING]),t[Nt.POINT]=[new Cu({image:new fu({radius:6,fill:new du({color:r}),stroke:new Ou({color:e,width:1.5})}),zIndex:1/0})],t[Nt.MULTI_POINT]=t[Nt.POINT],t[Nt.GEOMETRY_COLLECTION]=t[Nt.POLYGON].concat(t[Nt.LINE_STRING],t[Nt.POINT]),t}function Lu(t){return t.getGeometry()}var Mu=Cu,Fu={POINT:"point",LINE:"line"},Au="#333",Nu=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new du({color:Au}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:Fu.POINT,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:this.getScale(),text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}();function Gu(t,e){var r=/\{z\}/g,n=/\{x\}/g,i=/\{y\}/g,o=/\{-y\}/g;return function(a,s,u){return a?t.replace(r,a[0].toString()).replace(n,a[1].toString()).replace(i,a[2].toString()).replace(o,function(){var t=a[0],r=e.getFullTileRange(t);return K(r,55),(r.getHeight()-a[2]-1).toString()}):void 0}}function Du(t,e){for(var r=t.length,n=new Array(r),i=0;i=u.zoomMin&&a<=u.zoomMax){var h=u.bbox;if(bt(Ft([h[1],h[0],h[3],h[2]],l),t.extent)){n=!0;break}}}n&&r.push(e.attribution)}),r.push('Terms of Use'),r}.bind(this))}this.setState(mi.READY)}else this.setState(mi.ERROR)},e}(yl),El=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Tl=function(t){function e(e){var r=e||{},n=void 0!==r.projection?r.projection:"EPSG:3857",i=void 0!==r.tileGrid?r.tileGrid:hs({extent:fs(n),maxZoom:r.maxZoom,minZoom:r.minZoom,tileSize:r.tileSize});return t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,crossOrigin:r.crossOrigin,opaque:r.opaque,projection:n,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:r.tileLoadFunction,tilePixelRatio:r.tilePixelRatio,tileUrlFunction:r.tileUrlFunction,url:r.url,urls:r.urls,wrapX:void 0===r.wrapX||r.wrapX,transition:r.transition,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this}return El(e,t),e}(yl),Sl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xl=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:void 0!==e.maxZoom?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,wrapX:e.wrapX})||this;return r.account_=e.account,r.mapId_=e.map||"",r.config_=e.config||{},r.templateCache_={},r.initializeMap_(),r}return Sl(e,t),e.prototype.getConfig=function(){return this.config_},e.prototype.updateConfig=function(t){p(this.config_,t),this.initializeMap_()},e.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},e.prototype.initializeMap_=function(){var t=JSON.stringify(this.config_);if(this.templateCache_[t])this.applyTemplate_(this.templateCache_[t]);else{var e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);var r=new XMLHttpRequest;r.addEventListener("load",this.handleInitResponse_.bind(this,t)),r.addEventListener("error",this.handleInitError_.bind(this)),r.open("POST",e),r.setRequestHeader("Content-type","application/json"),r.send(JSON.stringify(this.config_))}},e.prototype.handleInitResponse_=function(t,e){var r=e.target;if(!r.status||r.status>=200&&r.status<300){var n=void 0;try{n=JSON.parse(r.responseText)}catch(t){return void this.setState(mi.ERROR)}this.applyTemplate_(n),this.templateCache_[t]=n,this.setState(mi.READY)}else this.setState(mi.ERROR)},e.prototype.handleInitError_=function(t){this.setState(mi.ERROR)},e.prototype.applyTemplate_=function(t){var e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)},e}(Tl),wl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature"},Rl=r(0),Ol=r.n(Rl),Cl=function(){function t(t){this.rbush_=new Ol.a(t),this.items_={}}return t.prototype.insert=function(t,e){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(r),this.items_[o(e)]=r},t.prototype.load=function(t,e){for(var r=new Array(e.length),n=0,i=e.length;n=0;--r){var n=this.geometryFunction(t[r]);n?Xn(e,n.getCoordinates()):t.splice(r,1)}qn(e,1/t.length);var i=new q(new Rr(e));return i.set("features",t),i},e}(bl),Fl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Al={DEFAULT:"default",TRUNCATED:"truncated"},Nl=function(t){function e(e,r,n,i,o,a,s){var u=t.call(this,r,n,i,o,a,s)||this;return u.zoomifyImage_=null,u.tileSize_=e,u}return Fl(e,t),e.prototype.getImage=function(){if(this.zoomifyImage_)return this.zoomifyImage_;var e=t.prototype.getImage.call(this);if(this.state==wn.LOADED){var r=this.tileSize_;if(e.width==r[0]&&e.height==r[1])return this.zoomifyImage_=e,e;var n=hi(r[0],r[1]);return n.drawImage(e,0,0),this.zoomifyImage_=n.canvas,n.canvas}return e},e}(Wu),Gl=function(t){function e(e){var r=this,n=e||{},i=n.size,o=void 0!==n.tierSizeCalculation?n.tierSizeCalculation:Al.DEFAULT,a=n.tilePixelRatio||1,s=i[0],u=i[1],l=[],h=n.tileSize||In,c=h*a;switch(o){case Al.DEFAULT:for(;s>c||u>c;)l.push([Math.ceil(s/c),Math.ceil(u/c)]),c+=c;break;case Al.TRUNCATED:for(var p=s,f=u;p>c||f>c;)l.push([Math.ceil(p/c),Math.ceil(f/c)]),p>>=1,f>>=1;break;default:K(!1,53)}l.push([1,1]),l.reverse();for(var d=[a],_=[0],g=1,y=l.length;g0&&_[0].tileCoord[0]===f)h=_,c=!0,p=f;else{h=[],p=f+1;do{--p,c=!0,u.forEachTileCoord(o,p,function(n){var i,o=this.tileUrlFunction(n,t,e);if(void 0!==o)if(this.sourceTileCache.containsKey(o)){var a=(i=this.sourceTileCache.get(o)).getState();if(a===wn.LOADED||a===wn.ERROR||a===wn.EMPTY)return void h.push(i)}else p===f&&((i=new this.tileClass(n,wn.IDLE,o,this.format_,this.tileLoadFunction)).extent=u.getTileCoordExtent(n),i.projection=e,i.resolution=u.getResolution(n[0]),this.sourceTileCache.set(o,i),i.addEventListener(N.CHANGE,this.handleTileChange.bind(this)),i.load());c=c&&i&&i.getState()===wn.LOADED,i&&i.getState()!==wn.EMPTY&&r.getState()===wn.IDLE&&(r.loadingSourceTiles++,i.addEventListener(N.CHANGE,function t(){var e=i.getState(),n=i.getKey();if(e===wn.LOADED||e===wn.ERROR){e===wn.LOADED?(i.removeEventListener(N.CHANGE,t),r.loadingSourceTiles--,delete r.errorSourceTileKeys[n]):e===wn.ERROR&&(r.errorSourceTileKeys[n]=!0);var o=Object.keys(r.errorSourceTileKeys).length;r.loadingSourceTiles-o==0&&(r.hifi=0===o,r.sourceZ=f,r.setState(wn.LOADED))}}))}.bind(this)),c||(h.length=0)}while(!c&&p>d)}return r.getState()===wn.IDLE&&r.setState(wn.LOADING),c&&(r.hifi=f===p,r.sourceZ=p,r.getState()11&&this.replayTextBackground_(u[0],u[13],u[14],u[15],u[16],u[11],u[12]),Ra.apply(void 0,u),h!==r&&(l.globalAlpha=h)}}t.length=5,lt(t)}}return n},t.prototype.drawLabelWithPointPlacement_=function(t,e,r,n){var i=this.textStates[e],o=this.createLabel(t,e,n,r),a=this.strokeStates[r],s=this.pixelRatio,u=ip[i.textAlign||"center"],l=ip[i.textBaseline||"middle"],h=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:u*(o.width/s-2*i.scale)+2*(.5-u)*h,anchorY:l*o.height/s+2*(.5-l)*h}},t.prototype.execute_=function(t,e,r,n,i,o){var a,s,u;this.declutterItems.length=0,this.pixelCoordinates_&&O(e,this.renderedTransform_)?a=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),a=Gt(this.coordinates,0,this.coordinates.length,2,e,this.pixelCoordinates_),s=this.renderedTransform_,u=e,s[0]=u[0],s[1]=u[1],s[2]=u[2],s[3]=u[3],s[4]=u[4],s[5]=u[5]);for(var l,h,c,p,f,d,_,g,y,v,m,E,T,S,x,w,R,C=0,P=r.length,I=0,b=0,L=0,M=null,F=null,A=this.coordinateCache_,N=this.viewRotation_,G=Math.round(1e12*Math.atan2(-e[1],e[0]))/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:N},j=this.instructions!=r||this.overlaps?0:200;C=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),this.geometryFunction_(r,n,i)):this.mode_===vf.POLYGON&&((r=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),e&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,n,i)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();this.mode_===vf.LINE_STRING?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e,r),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===vf.POLYGON&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,r)),0===t.length&&(this.finishCoordinate_=null),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,r=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===vf.LINE_STRING?(e.pop(),this.geometryFunction_(e,r,n)):this.mode_===vf.POLYGON&&(e[0].pop(),this.geometryFunction_(e,r,n),e=r.getCoordinates()),this.type_===Nt.MULTI_POINT?t.setGeometry(new ff([e])):this.type_===Nt.MULTI_LINE_STRING?t.setGeometry(new cf([e])):this.type_===Nt.MULTI_POLYGON&&t.setGeometry(new gf([e])),this.dispatchEvent(new Tf(Ef,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.appendCoordinates=function(t){var e=this.mode_,r=[];e===vf.LINE_STRING?r=this.sketchCoords_:e===vf.POLYGON&&(r=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]);for(var n=r.pop(),i=0;i